package com.shilei.spring.aop;

import com.shilei.spring.aop.aop.AopPrint;
import com.shilei.spring.aop.cglib.CglibFactory;

/**
 * @author shilei
 * @date 2021年8月31日16:14:35
 * cglib 动态代理实现测试类
 */
public class Test {
    public String doFirst() {System.out.println("执行doFirst()方法");return "abcde";}

    public void doSecond() {
        System.out.println("doSecond()方法");
    }

    public void doError() {
        throw  new Error("异常出现了");
    }

    public static void main(String[] args) {

        Test proxy = (Test)new CglibFactory().myCglibCreator(Test.class,new AopPrint());

        proxy.doFirst();
        proxy.doSecond();
        proxy.doError();
    }
}
